package com.fanhang.samples.spring.sql2o.common;

import javax.sql.DataSource;

public class DefaultSql2oSessionFactory implements Sql2oSessionFactory {

	private DataSource dataSource;
	
	public DefaultSql2oSessionFactory(DataSource dataSource) {
		this.dataSource = dataSource;
	}
	
	public void setDataSource(DataSource dataSource) {
		this.dataSource = dataSource;
	}

	@Override
	public Sql2oSession openSession() {
		return new DefaultSql2oSession(dataSource);
	}

	@Override
	public Sql2oSession openSession(DataSource dataSource) {
		return new DefaultSql2oSession(dataSource);
	}

}
